package uutalk.netcloud.talk.model.bean;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;

/**
 * Created by Pmt on 2017/7/8.
 */
@Entity
public class BlueChannelSetting {

    @Id
    private long id = 0;//信道号
    private int channelNum = 0;//信道号
    private String recHz = "";//接受频率
    private String sendHz = "";//发射频率
    private int decodeCtcDcs = 0;//CtcDcs解码类型
    private String strDecodeCtcDcs = "";//CtcDcs值
    private int encodeCtcDcs = 0;//CtcDcs编码类型
    private String strEncodeCtcDcs = "";//CtcDcs编码值
    private int scanAdd = 0;//扫描添加
    private int bandwidth = 0;//带宽
    private int transmitPower = 0;//发射功率
    private int busyLock = 0;//繁忙锁定
    private int scramble = 0;//扰频
    private int companding = 0;//压扩
    private int specialSignaling = 0;//特殊信令

    @Generated(hash = 305308237)
    public BlueChannelSetting(long id, int channelNum, String recHz, String sendHz, int decodeCtcDcs, String strDecodeCtcDcs, int encodeCtcDcs, String strEncodeCtcDcs, int scanAdd,
            int bandwidth, int transmitPower, int busyLock, int scramble, int companding, int specialSignaling) {
        this.id = id;
        this.channelNum = channelNum;
        this.recHz = recHz;
        this.sendHz = sendHz;
        this.decodeCtcDcs = decodeCtcDcs;
        this.strDecodeCtcDcs = strDecodeCtcDcs;
        this.encodeCtcDcs = encodeCtcDcs;
        this.strEncodeCtcDcs = strEncodeCtcDcs;
        this.scanAdd = scanAdd;
        this.bandwidth = bandwidth;
        this.transmitPower = transmitPower;
        this.busyLock = busyLock;
        this.scramble = scramble;
        this.companding = companding;
        this.specialSignaling = specialSignaling;
    }

    @Generated(hash = 895407609)
    public BlueChannelSetting() {
    }

    public BlueChannelSetting(BlueChannelSetting blueChannelSetting){
        this.id = blueChannelSetting.id;
        this.channelNum = blueChannelSetting.channelNum;
        this.recHz = blueChannelSetting.recHz;
        this.sendHz = blueChannelSetting.sendHz;
        this.decodeCtcDcs = blueChannelSetting.decodeCtcDcs;
        this.strDecodeCtcDcs = blueChannelSetting.strDecodeCtcDcs;
        this.encodeCtcDcs = blueChannelSetting.encodeCtcDcs;
        this.strEncodeCtcDcs = blueChannelSetting.strEncodeCtcDcs;
        this.scanAdd = blueChannelSetting.scanAdd;
        this.bandwidth = blueChannelSetting.bandwidth;
        this.transmitPower = blueChannelSetting.transmitPower;
        this.busyLock = blueChannelSetting.busyLock;
        this.scramble = blueChannelSetting.scramble;
        this.companding = blueChannelSetting.companding;
        this.specialSignaling = blueChannelSetting.specialSignaling;
    }


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getChannelNum() {
        return channelNum;
    }

    public void setChannelNum(int channelNum) {
        this.channelNum = channelNum;
    }

    public String getRecHz() {
        return recHz;
    }

    public void setRecHz(String recHz) {
        this.recHz = recHz;
    }

    public String getSendHz() {
        return sendHz;
    }

    public void setSendHz(String sendHz) {
        this.sendHz = sendHz;
    }

    public int getDecodeCtcDcs() {
        return decodeCtcDcs;
    }

    public void setDecodeCtcDcs(int decodeCtcDcs) {
        this.decodeCtcDcs = decodeCtcDcs;
    }

    public int getEncodeCtcDcs() {
        return encodeCtcDcs;
    }

    public void setEncodeCtcDcs(int encodeCtcDcs) {
        this.encodeCtcDcs = encodeCtcDcs;
    }

    public String getStrDecodeCtcDcs() {
        return strDecodeCtcDcs;
    }

    public void setStrDecodeCtcDcs(String strDecodeCtcDcs) {
        this.strDecodeCtcDcs = strDecodeCtcDcs;
    }

    public String getStrEncodeCtcDcs() {
        return strEncodeCtcDcs;
    }

    public void setStrEncodeCtcDcs(String strEncodeCtcDcs) {
        this.strEncodeCtcDcs = strEncodeCtcDcs;
    }

    public int getScanAdd() {
        return scanAdd;
    }

    public void setScanAdd(int scanAdd) {
        this.scanAdd = scanAdd;
    }

    public int getBandwidth() {
        return bandwidth;
    }

    public void setBandwidth(int bandwidth) {
        this.bandwidth = bandwidth;
    }

    public int getTransmitPower() {
        return transmitPower;
    }

    public void setTransmitPower(int transmitPower) {
        this.transmitPower = transmitPower;
    }

    public int getBusyLock() {
        return busyLock;
    }

    public void setBusyLock(int busyLock) {
        this.busyLock = busyLock;
    }

    public int getScramble() {
        return scramble;
    }

    public void setScramble(int scramble) {
        this.scramble = scramble;
    }

    public int getCompanding() {
        return companding;
    }

    public void setCompanding(int companding) {
        this.companding = companding;
    }

    public int getSpecialSignaling() {
        return specialSignaling;
    }

    public void setSpecialSignaling(int specialSignaling) {
        this.specialSignaling = specialSignaling;
    }

//    public String toHexStr() {
//        StringBuilder sb = new StringBuilder();
//        //频率 57 00 10 08 00 25 01 42 00 25 01 42
//        if((channelNum+1) == 16){
//            sb.append("570100"); //57 00
//        } else {
//            sb.append("5700") //57 00
//                    .append(Integer.toHexString(channelNum+1))
//                    .append(0);
//        }
//
//        sb.append("08")//08
//          .append(getHzHexStr(getRecHz()))//00 25 01 42
//          .append(getHzHexStr(getSendHz()));//00 25 01 42
//
//        //CTC/DCS以及各种开关协议 57 00 18 08 93 06 93 06 16 FF FF FF
//        if((channelNum+1) == 16){
//            sb.append("57010808"); //57 00
//        } else {
//            sb.append("5700") //57 00
//                    .append(Integer.toHexString(channelNum+1))
//                    .append("808");
//        }
//
//        sb.append(getCtcDcsHexStr(getDecodeCtcDcs(),getStrDecodeCtcDcs()))//CtcDcs解码
//                .append(getCtcDcsHexStr(getEncodeCtcDcs(),getStrEncodeCtcDcs()))//CtcDcs编码
//                .append(getOtherHexStr());
//
//        // 特殊信令 7  压扩 6 扰频 5 扫描添加 4
//        int hightNum = specialSignaling * 8 + companding*4+scramble*2+scanAdd;
//        // 发射功率 3  带宽 2  繁忙锁定 0
//        int lowNum = transmitPower * 8 + bandwidth*4+1*2+busyLock;
//        sb.append(Integer.toHexString(hightNum)).append(Integer.toHexString(lowNum));
//        sb.append("FFFFFF");//结尾
//        return sb.toString();
//    }


//    /**
//     * 获取频率的协议值
//     * @param hz
//     * @return
//     */
//    private String getHzHexStr(String hz) {
//        //转成double
//        Double f  = Double.valueOf(hz);
//        f = f * 100000;//小数点前移5位
//        long ll = new Double(f).longValue();
//        String str = ll + "";
//
//        if(str.length() != 8){
//            return null;
//        }
//
//        StringBuilder sb = new StringBuilder();
//        sb.append(str.substring(6,8));
//        sb.append(str.substring(4,6));
//        sb.append(str.substring(2,4));
//        sb.append(str.substring(0,2));
//
//        return sb.toString();
//    }
//
//    /**
//     * 获得CtcDcs协议值
//     * @param selItemNum CtcDcs选项
//     * @param dataStr CtcDcs字符串值
//     * @return CtcDcs协议值
//     */
//    private String getCtcDcsHexStr(int selItemNum, String dataStr) {
//
//        StringBuilder sb = new StringBuilder();
//
////        if (selItemNum == 0) {
////            sb.append("FFFF");
////        } else if (1 <= selItemNum && selItemNum <= 50) {
////            dataStr = dataStr.replace(".", "");//去掉小数点
////            int numData = Integer.valueOf(dataStr);//转成整数型
////            int bai = numData / 100;//百位以上数据
////            int geShi = numData % 100;////百位以下数据
////            //协议格式 67.7  	数据 0x77 0x06
////            sb.append(geShi);//0x77
////            if (bai < 10) { // 0x06
////                sb.append(0).append(bai);
////            } else {
////                sb.append(bai);
////           }
////        } else {
////            int length = dataStr.length();
////            dataStr = dataStr.substring(1, length-2);// D023N 去掉D,N
////            //D023N	数据0x23 0x80
////            int dataInt = Integer.valueOf(dataStr);
////            sb.append(dataInt%100)//0x23
////                    .append(8).append(dataInt/100);//0x80
////
////        }
//
//        if (selItemNum == 0) {
//            sb.append("FFFF");//没有选择，填FFFF
//        } else {
//            if(dataStr.contains("I")){
//                dataStr = dataStr.replace("D","");
//                dataStr = dataStr.replace("I","");
//                sb.append(dataStr.substring(1,3));
//                sb.append("C"+dataStr.substring(0,1));
//            } else if(dataStr.contains("N")){
//                dataStr = dataStr.replace("D","");
//                dataStr = dataStr.replace("N","");
//                sb.append(dataStr.substring(1,3));
//                sb.append("8"+dataStr.substring(0,1));
//            } else if(dataStr.contains(".")){
//                dataStr = dataStr.replace(".","");
//                if(dataStr.length() == 4){
//                    sb.append(dataStr.substring(2,4));
//                    sb.append(dataStr.substring(0,2));
//                } else if(dataStr.length() == 3){
//                    sb.append(dataStr.substring(1,3));
//                    sb.append("0");
//                    sb.append(dataStr.substring(0,1));
//                }
//            } else {
//                //数据可能有问题
//                sb.append("FFFF");//没有选择，填FFFF
//            }
//        }
//
//        return sb.toString();
//    }
//
//    /**
//     * 其他开关的协议
//     * @return
//     */
//    public String getOtherHexStr() {
//        return "";
//    }
}
